var frame_tree = null;
var frame_root = null;
var frame_center = null;
var isTopOpen=true;
function changePassword() {
	
var form1 = new Ext.form.FormPanel({xtype : "formpanel",title : "",labelWidth : 95,labelAlign : "right",layout : "form",height : 142,buttonAlign : "center",items : [{name : "oldpwd",xtype : "textfield",inputType : 'password',fieldLabel : "旧密码",allowBlank : false,anchor : "90%"},{name : "newpwd",xtype : "textfield",inputType : 'password',fieldLabel : "新密码",allowBlank : false,anchor : "90%"},{name : "okpwd",xtype : "textfield",inputType : 'password',fieldLabel : "确认密码",allowBlank : false,anchor : "90%",validator:function(v){ return v==''?"请输入确认密码":(v==form1.get(1).getValue()?true:'新密码与确认密码不符');}}]});
	var windowm = new Ext.Window({title : "修改密码",width : 320,height : 150,buttonAlign : "center",layout : "fit",	modal : true,plain : true,items : [form1],buttons:[{text : '提交',handler : function() {if (form1.getForm().isValid()) {form1.getForm().submit({url : '../login.do?action=changePassword',method : 'POST',waitMsg : '正在保存...',reset : false,success : function(form, action) {Ext.MessageBox.show({title : '操作成功',width:150,msg :  action.result.info,buttons : Ext.Msg.OK,icon : Ext.MessageBox.INFO});	windowm.close();},failure : function(form, action) {Ext.MessageBox.show({title : '操作失败',width:200,msg : action.result.info,buttons : Ext.Msg.OK,icon : Ext.MessageBox.ERROR});}});}}},{text : '重置',handler : function() {form1.getForm().reset();}}]});windowm.show();
}
Ext.onReady(function() {
	addLogout();
	Ext.BLANK_IMAGE_URL=basepath+"/image/s.gif";
	Ext.QuickTips.init();   
	Ext.form.Field.prototype.msgTarget = 'side';
	Ext.MessageBox.minWidth=210;
			frame_center = new Ext.TabPanel({
						region : 'center',
						deferredRender : false,
						enableTabScroll : true,
						bufferResize : true,
						defaults : {
							autoScroll : true
						},
						autoDestroy : true,
						//resizeTabs : true, // turn on tab resizing
						activeTab : 0,
						minTabWidth: 120,
						items : [{
									xtype : 'htmlpanel',
									id : 'welcome',
									title : '首页',
									autoScroll : true,
									layout : 'fit',
									border : false,
									loadMask : {},
									defaultSrc : 'loginlist.jsp'
								}],

						plugins : new Ext.ux.TabCloseMenu()
					});
			frame_tree = new Ext.tree.TreePanel({
						region : 'west',
						animate : false,
						enableDD : false,
						loader : new Ext.tree.TreeLoader(),
						lines : true,
						selModel : new Ext.tree.MultiSelectionModel(),
						containerScroll : false,
						title : '系统菜单',split : true,width : 186,minSize : 175,maxSize : 400,collapsible : true,autoScroll : true,rootVisible : false,margins : '0 0 0 0'
					});
			frame_root = new Ext.tree.AsyncTreeNode({text : '系统功能',draggable : false,id : 'source',loader : new Ext.tree.TreeLoader({
						dataUrl :   basepath+"../sysControl/permission/LoginController/menu.do"
					})});
			frame_tree.setRootNode(frame_root);
			var northDiv=new Ext.BoxComponent({region : 'north',el : 'north-div',minSize: 20, maxSize: 90,height:55})

			var viewport = new Ext.Viewport({layout : 'border',items : [northDiv, frame_tree, frame_center]});
			var frameAddTab = function(node) {
				if (node.isLeaf()) {
					var taburl = node.attributes.url;
					var tabItem = frame_center.getItem("tab"+node.id);
					if (tabItem == null) {
						
						tabItem = frame_center.add(new Ext.Panel({
								id : "tab"+node.id,
								title : node.text,
								closable : true,
								autoHeight : true,
								autoScroll : true,
								layoutOnTabChange : true,
								layout : 'fit',
								border : false,
								autoLoad : {url : taburl,scripts : true,callback : this.initSearch,scope : this,discardUrl : true,nocache : false,text : "页面加载中,请稍候……",timeout : 9000}
								}));
					
					}
					if(tabItem)
					tabItem.show();
				}
			}

			frame_tree.render();
		    frame_tree.on('click', frameAddTab);
		    frame_root.expand(false,false,function(){if(frame_root.firstChild!=null) frame_root.firstChild.expand();});
			Ext.getBody().on("keydown",function (e){
			if(e.getKey()==e.F9){
				     if(isTopOpen){
					northDiv.hide();
					isTopOpen=false;
					}else{
					northDiv.show();
						isTopOpen=true;
					}
					viewport.syncSize();
			}
				
			});
		});

Ext.ux.tree={};
